package com.example.transaction.consumer;

import com.example.transaction.config.RabbitMQConfig;
import com.example.transaction.sys.service.IOrderService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrderExpirationConsumer {

    @Autowired
    private IOrderService orderService;

    @RabbitListener(queues = RabbitMQConfig.ORDER_EXPIRATION_QUEUE)
    public void handleOrderExpiration(Integer orderId) {
        orderService.cancelOrder(orderId);
    }
}
